using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Emlyn.Common.Data.SqlServer.SqlManagers;
using System.Data.SqlClient;
using Emlyn.Common.Tools.BusinessLayer;

namespace Emlyn.Website.Users
{
    public class EWebsiteQuery: BaseQuery<EWebsite, string, EWebsiteDataLayer>
    {
        public EWebsiteQuery()
            : base(new EWebsiteDataLayer())
        {
        }

        public EWebsite GetWebsiteByUserID(Guid aUserID)
        {
            return ConstructInstanceFromDataSet(_dl.GetWebsiteByUserID(aUserID));
        }

        protected override EWebsite ConstructInstanceFromRow(DataRow lrow)
        {
            EWebsite lwebsite = new EWebsite(Convert.ToString(lrow["WebsiteCode"]).Trim());
            lwebsite.Version = Convert.ToInt32(lrow["DBVersion"]);

            return lwebsite;
        }
    }
}
